package com.jinhu.controller;

import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.jinhu.ResultEntity;
import com.jinhu.ocr.OcrService;
import org.noear.solon.annotation.Body;
import org.noear.solon.annotation.Controller;
import org.noear.solon.annotation.Inject;
import org.noear.solon.annotation.Mapping;

@Controller
public class OcrController {
    @Inject
    OcrService ocrService;
    public ResultEntity ocrImg(@Body JSONObject body){
        if(JSONUtil.isNull(body)) return ResultEntity.no("参数为空");
        JSONObject entries = ocrService.orcImg(body.getStr("img"));
        return ResultEntity.ok("解析成功",entries);
    }
}
